package Exercise;

public class PhoneTest {
    public static void main(String[] args) {
        Phone arr[]=new Phone[3];
        Phone s1=new Phone("mi",1999,"red");
        Phone s2=new Phone("apple",7299,"grey");
        Phone s3=new Phone("meizu",12999,"blue");
        arr[0]=s1;
        arr[1]=s2;
        arr[2]=s3;
//        Phone s1=new Phone();
//        Phone s2=new Phone();
//        Phone s3=new Phone();
//        s1.setPrice(1999.0);
//        s2.setPrice(12999.0);
//        s3.setPrice(7299.0);
//        Phone arr[]={s1,s2,s3};
        int sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i].getPrice();
        }
        System.out.println("平均价格为"+sum*1.0/ arr.length);
    }
}
